import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { State } from '../../../store';
import * as fromRouterState from '../../../store/selectors/router-state.selector';
import { Observable } from 'rxjs';
import { Breadcrumb } from './breadcrumb.model';

@Component({
  selector: '[am-breadcrumb]',
  templateUrl: './breadcrumb.component.html',
  styleUrls: ['./breadcrumb.component.scss']
})
export class BreadcrumbComponent implements OnInit {

  breadcrumb$: Observable<Breadcrumb[]>;

  constructor(
    private store: Store<State>
  ) { }

  ngOnInit() {
    this.breadcrumb$ = this.store.select(fromRouterState.getBreadcrumbSelector);
  }

}
